<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.ArrayList" %>    
<%@ page import=" java.util.List" %>    
<%@ page import=" com.demo.entity.User" %>       

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户信息管理</title>
<script type="text/javascript">
    function checkUser() {
        alert("无法操作超级管理员，请联系开发者 ! ");
        return false;
    }
</script>
</head>
<body>
<center>
        <fieldset>
            <legend style="color:#00f" > <h3>用户列表信息管理</h3></legend>
            <table border="1">
                <tr>
                    <th>编号</th>
                    <th>邮箱</th>
                    <th>账号</th>
                    <th>密码</th>
                    <th>身份</th>
                    <th>状态</th>
                    <th>注册时间</th>
                    <th colspan="2">CURD</th>
                </tr>
                <% List<User> userList = (ArrayList<User>)session.getAttribute("userInfoList");
                for(User userInfoList : userList){
                %>
                <tr>
                     <th><%=userInfoList.getUserId() %></th>
                     <th><%=userInfoList.getEmail() %></th>
                    <th><%=userInfoList.getUsername() %></th>
                    <th><%=userInfoList.getPassword() %></th>
                    
                    <%if(userInfoList.getType() == 1 && userInfoList.getUserId()==1 ){  %>
                    <th  style="color: #f00">超级管理员</th>
                    <%}else if(userInfoList.getType() == 1){ %>
                    <th style="color: #00f">管理员</th>
                    <%}else if(userInfoList.getType() == 0){ %>
                    <th style="color: #0f0">普通用户</th>
                    <%} %>
                    
                    <%if(userInfoList.getType() == 1 && userInfoList.getUserId()==1 ){  %>
                    <th style="color: #f00">在线</th>
                    <%}else if(userInfoList.getState() == 1){ %>
                    <th style="color: #00f">在线</th>
                    <%}else if(userInfoList.getState() == 0){ %>
                    <th style="color: #aaa">离线</th>
                    <%} %>
                    
                    <th><%=userInfoList.getRegistTime() %></th>

                    <%if(userInfoList.getType() == 1 && userInfoList.getUserId()==1){ %>
                    <th><a href="#" onclick="return checkUser();">删除</a></th>
                    <th><a href="#" onclick="return checkUser();">修改</a></th>
                    <%}else{ %>
                    <th><a href="user_info_del_action/<%=userInfoList.getUserId() %>" >删除</a></th>
                    <th><a href="showUserInfo/<%=userInfoList.getUserId() %>">修改</a></th>
                    <%} %>            
 
                </tr>
                <% 
                }
                %>
                 <tr><th colspan="9" align="center"><a href="/WebStoreSSM/register.jsp">增加</a>
                                                                                     <a href="user_info_list_action">更新</a>
                                                                                     <a href="/WebStoreSSM/views/pageAdmin.jsp">返回系统管理</a></th></tr>
            </table>
        </fieldset>
</center>
</body>
</html>